package com.jeval;

import net.sourceforge.jeval.Evaluator;
import parsii.eval.Expression;
import parsii.eval.Parser;
import parsii.eval.Scope;
import parsii.eval.Variable;

import java.util.Collections;

/**
 * @author zhangyan
 * @version $ Id: Jeval.java, v 0.1 2021/7/1 19:25 zhangyan Exp $
 */
public class Jeval {
    public static void main(String[] args) throws Exception{
        String exp = "10/3";
        Expression parse = Parser.parse(exp);
        double evaluate = parse.evaluate();
        System.out.println(evaluate);


        Evaluator evaluator = new Evaluator();
        evaluator.setVariables(Collections.singletonMap("x",Double.toString(1111.000)));
        double v = Double.parseDouble(evaluator.evaluate(exp));
        String evaluate1 = evaluator.evaluate(exp);
        System.out.println(v);
        System.out.println(evaluate1);
        Long.valueOf("aaa");
    }
}
